package com.zhima.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.zhima.enums.QuestionDifficulty;
import com.zhima.enums.QuestionPublishState;
import com.zhima.enums.QuestionScope;
import com.zhima.enums.ScoreStrategy;
import com.zhima.typehandler.InOutExampleTypeHandler;
import com.zhima.typehandler.SimpleLabelVOTypeHandler;
import com.zhima.typehandler.TestCaseTemplatesTypeHandler;
import com.zhima.vo.SimpleLabelVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author zhima
 * @since 2023-08-25
 */
@Data
@TableName(value = "oj_question_publish", autoResultMap = true)
@ApiModel(value = "OjQuestionPublish对象", description = "")
public class OjQuestionPublish implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("题目id")
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    @ApiModelProperty("提交发布的时间")
    @TableField(value = "submit_time", fill = FieldFill.INSERT)
    private Date submitTime;

    @ApiModelProperty("审核时间")
    @TableField("publish_time")
    private Date publishTime;

    @ApiModelProperty("出题时间")
    @TableField("create_time")
    private Date createTime;

    @ApiModelProperty("修改时间")
    @TableField("update_time")
    private Date updateTime;

    @ApiModelProperty("出题人id")
    @TableField("uploader_id")
    private Long uploaderId;

    @ApiModelProperty("出题人头像uri")
    @TableField("uploader_avatar_uri")
    private String uploaderAvatarUri;

    @ApiModelProperty("题目前缀，用来区分不同的题目类型")
    @TableField("prefix")
    private String prefix;

    @ApiModelProperty("该前缀下的号码")
    @TableField("number")
    private Integer number;

    @ApiModelProperty("题目名")
    @TableField("title")
    private String title;

    @ApiModelProperty("难度（EASY、MEDIUM、HARD、UNBELIEVABLE）")
    @TableField("difficulty")
    private QuestionDifficulty difficulty;

    @ApiModelProperty("题目可见域、私有、共有、比赛")
    @TableField("scope")
    private QuestionScope scope;

    @ApiModelProperty("标签信息")
    @TableField(value = "labels", typeHandler = SimpleLabelVOTypeHandler.class)
    private List<SimpleLabelVO> labels;

    @ApiModelProperty("提交次数")
    @TableField("submit_num")
    private Integer submitNum;

    @ApiModelProperty("AC次数")
    @TableField("ac_num")
    private Integer acNum;

    @ApiModelProperty("通过率，即提交次数/AC次数")
    @TableField("passing_rate")
    private BigDecimal passingRate;

    @ApiModelProperty("发布中、已发布、发布失败")
    @TableField("state")
    private QuestionPublishState state;

    @ApiModelProperty("发布失败的原因")
    @TableField("advice")
    private String advice;

    @ApiModelProperty("题目背景（markdown格式）")
    @TableField("background")
    private String background;

    @ApiModelProperty("题目描述（markdown格式）")
    @TableField("description")
    private String description;

    @ApiModelProperty("输入格式（markdown格式）")
    @TableField("input_format")
    private String inputFormat;

    @ApiModelProperty("输出格式（markdown格式）")
    @TableField("output_format")
    private String outputFormat;

    @ApiModelProperty("输入输出样例（markdown格式）")
    @TableField(value = "in_out_examples", typeHandler = InOutExampleTypeHandler.class)
    private List<InOutExample> inOutExamples;

    @ApiModelProperty("说明/提示（markdown格式）")
    @TableField("tips")
    private String tips;

    @ApiModelProperty("测试用例文件的id")
    @TableField("test_case_file_id")
    private Long testCaseFileId;

    @ApiModelProperty("测试用例信息，包括文件的minio地址，每个测试用例的具体测试信息")
    @TableField(value = "test_case_templates", typeHandler = TestCaseTemplatesTypeHandler.class)
    private List<TestCaseTemplate> testCaseTemplates;

    @ApiModelProperty("题目总分")
    @TableField(value = "full_mark")
    private Integer fullMark;

    @ApiModelProperty("最大时间限制")
    @TableField("max_time_limit")
    private BigDecimal maxTimeLimit;

    @ApiModelProperty("最大内存限制")
    @TableField("max_memory_limit")
    private BigDecimal maxMemoryLimit;

    @ApiModelProperty("总分计分策略")
    @TableField("score_strategy")
    private ScoreStrategy scoreStrategy;

    @ApiModelProperty("SPJ总计分文件id")
    @TableField("spj_file_id")
    private Long spjFileId;

    @ApiModelProperty("版本号")
    @TableField(value = "version", fill = FieldFill.INSERT)
    @Version
    private Long version;
}
